import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import postdatail from "@/views/postDatail.vue";
import login from "../views/login.vue";
import Register from "@/views/Register.vue";
import PersonalIndex from "@/views/personal/index.vue";
import modified from "@/views/personal/modified.vue";
import edit from "@/views/personal/edit.vue";
import follows from "@/views/personal/follows.vue";
import cheshiye from "@/views/personal/cheshiye.vue";
import collect from "@/views/personal/collect.vue";
import Setting from "@/views/personal/Setting.vue";
// import { component } from "vue/types/umd";
// import { component } from "vue/types/umd";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/postdatail/:id",
    name: "postDatailPage",
    component: postdatail,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: function() {
      return import(/* webpackChunkName: "about" */ "../views/About.vue");
    },
  },
  // 登录页
  {
    path: "/login",
    name: "loginPage",
    component: login,
  },
  // 注册页
  {
    path: "/Register",
    name: "registerPage",
    component: Register,
  },
  // 个人中心页
  {
    path: "/personal",
    name: "personalPage",
    component: PersonalIndex,
  },
  //  修改信息页
  {
    path: "/modified",
    name: "modidied",
    component: modified,
  },
  {
    path: "/edit",
    name: "editPage",
    component: edit,
  },
  // 关注页
  {
    path: "/follows",
    name: "followsPage",
    component: follows,
  },
  //测试页
  {
    path: "/cheshiye",
    name: "cheshiyePage",
    component: cheshiye,
  },
  //收藏页
  {
    path: "/collect",
    name: "collectPage",
    component: collect,
  },
  // 设置页
  {
    path: "/Setting",
    name: "SettingPage",
    component: Setting,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
